//package com.example.mongo.appmongo.config;
//
//import org.springframework.beans.factory.config.BeanDefinition;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Role;
//import org.springframework.transaction.annotation.AbstractTransactionManagementConfiguration;
//import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource;
//import org.springframework.transaction.config.TransactionManagementConfigUtils;
//import org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor;
//import org.springframework.transaction.interceptor.TransactionAttributeSource;
//import org.springframework.transaction.interceptor.TransactionInterceptor;
//
///**
// * @author sjw
// * @className UserProxyTransactionManagementConfiguration
// * @date 2021/9/29 19:18
// * @description: TODO
// */
////@Configuration
//public class UserProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration {
//
//    @Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
//    @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
//    public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
//        BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
//        advisor.setTransactionAttributeSource(transactionAttributeSource());
//        advisor.setAdvice(transactionInterceptor());
//        if (this.enableTx != null) {
//            advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
//        }
//        return advisor;
//    }
//
//    @Bean
//    @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
//    public TransactionAttributeSource transactionAttributeSource() {
//        return new UserAnnotationTransactionAttributeSource();
//    }
//
//    @Bean
//    @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
//    public TransactionInterceptor transactionInterceptor() {
//        TransactionInterceptor interceptor = new TransactionInterceptor();
//        interceptor.setTransactionAttributeSource(transactionAttributeSource());
//        if (this.txManager != null) {
//            interceptor.setTransactionManager(this.txManager);
//        }
//        return interceptor;
//    }
//
//
//}
